﻿//---------------------------------------------------------------------------
// <copyright file="RibbonBooleanToVisibilityConverter.cs" company="Microsoft Corporation">
//     Copyright (C) Microsoft Corporation.  All rights reserved.
// </copyright>
//---------------------------------------------------------------------------

namespace Microsoft.Windows.Controls.Ribbon
{
    using System;
    using System.Globalization;
    using System.Windows;
    using System.Windows.Data;

    /// <summary>
    ///   A ValueConverter used to get the reverse conversion from bool to Visibility.  This
    ///   is used to disabled ToolTips when popups are open.
    /// </summary>
    internal sealed class RibbonBooleanToVisibilityConverter : IValueConverter
    {
        /// <summary>
        ///   Returns the opposite of the default BooleanToVisibilityConverter.
        /// </summary>
        /// <param name="value">The value produced by the binding source.</param>
        /// <param name="targetType">The type of the binding target property.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>Visibility.Collapsed if the input Boolean is true, Visibility.Visible otherwise.</returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return ((bool)value) == true ? Visibility.Collapsed : Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}